package io.renren.modules.im.controller;

import io.renren.common.utils.R;
import io.renren.modules.im.entity.IMFriends;
import io.renren.modules.im.service.IMFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/im/friends")
public class IMFriendController {

    @Autowired
    private IMFriendService imFriendService;

    @GetMapping("/add")
    public R addFriends(@RequestParam Map<String, Object> params) {

        System.out.println(params.toString());
        return R.ok();
    }

    @PostMapping("/list")
    public R listFriends(@RequestParam Map<String, Object> params) {
        long userId = Long.parseLong(params.get("userId").toString());
        List<IMFriends> friendsList = imFriendService.listFriendsByUserId(userId);
        return R.ok().put("data", friendsList);
    }

//    /**
//     * 所有用户列表
//     */
//    @GetMapping("/list")
////    @RequiresPermissions("sys:user:list")
//    public R list(@RequestParam Map<String, Object> params){
//        //只有超级管理员，才能查看所有管理员列表
////        if(getUserId() != Constant.SUPER_ADMIN){
////            params.put("createUserId", getUserId());
////        }
////        PageUtils page = sysUserService.queryPage(params);
//
////        return R.ok().put("page", page);
//        return null;
//    }


}
